﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

namespace CSMF
{
    public partial class UserCenter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnUp_Click(object sender, EventArgs e)
        {
            if (this.fuInsertLogo.PostedFile.FileName != "")
            {
                var picUrl = UserLogoService.FileUploads(fuInsertLogo, "..\\..\\UpLoad\\UserLogo\\");
                lblIMessage.Text = "图片上传成功！";
                this.imgInsertLogo.ImageUrl = picUrl;
                this.UserLogoUrl.Value = picUrl;
            }
            else
            {
                lblIMessage.Text = "请选择要上传的图片！";
            }
        }


       

        protected void SaveLogoBtn_Click(object sender, EventArgs e)
        {
            var webContext = new WebWorkContext();
            var userService = new UserService();
            var user = webContext.CurrentUser;
            var logoUrl = UserLogoService.GetUserLogo(this.UserLogoUrl.Value);
            userService.UpdateUserLogo(user.Id, logoUrl);

        }
    }
}